﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TournamentDatabase.Database
{
	public class OracleDataReader
	{
		Dictionary<string, int> m_columns;
		List<string[]> m_rows;
		int m_rowPointer;

		public OracleDataReader(string[] columns)
		{
			m_rowPointer = -1;

			m_columns = new Dictionary<string, int>();
            for (int i = 0; i < columns.Length; i++)
            {
                m_columns.Add(columns[i], i);
            }

			m_rows = new List<string[]>();

		}
        internal void Add(string[] column)
        {
            m_rows.Add(column);
        }

        public bool Read()
        {
            m_rowPointer++;
            return m_rowPointer < m_rows.Count;
        }

		public string this[string column]
		{
			get { return m_rows[m_rowPointer][m_columns[column]]; }
		}

	}
}
